/**
 * @param {?} el
 * @param {?} classMap
 * @param {?} renderer
 * @return {?}
 */
function removeClass(el, classMap, renderer) {
  // tslint:disable-next-line: forin
  for (const i in classMap) {
      renderer.removeClass(el, i);
  }
}
/**
* @param {?} el
* @param {?} classMap
* @param {?} renderer
* @return {?}
*/
function addClass(el, classMap, renderer) {
  for (const i in classMap) {
      if (classMap[i]) {
          renderer.addClass(el, i);
      }
  }
}
/**
* 更新宿主组件样式 `class`，例如：
*
* ```ts
* updateHostClass(
*  this.el.nativeElement,
*  this.renderer,
*  {
*    [ 'classname' ]: true,
*    [ 'classname' ]: this.type === '1',
*    [ this.cls ]: true,
*    [ `a-${this.cls}` ]: true
*  })
* ```
*
* @param {?} el
* @param {?} renderer
* @param {?} classMap
* @param {?=} cleanAll
* @return {?}
*/
export function updateHostClass(el, renderer, classMap, cleanAll = false) {
  if (cleanAll === true) {
      renderer.removeAttribute(el, 'class');
  }
  else {
      removeClass(el, classMap, renderer);
  }
  classMap = Object.assign({}, classMap);
  addClass(el, classMap, renderer);
}